<?php

declare(strict_types=1);

namespace App\Model;

use Hyperf\Database\Model\SoftDeletes;
use Hyperf\DbConnection\Model\Model;

class DataSpread extends Model
{
    use SoftDeletes;


    protected ?string $table = 'data_spread';


    public function applet()
    {
        return $this->hasOne(Applet::class, 'id', 'applet_id')->withTrashed()->select('id','name');
    }

    public function template()
    {
        return $this->hasOne(RechargeTemplate::class, 'id', 'recharge_template_id')->withTrashed()->select('id','name');
    }

    public function assistantTemplate()
    {
        return $this->hasOne(RechargeTemplate::class, 'id', 'assistant_recharge_template_id')->withTrashed()->select('id','name');
    }

    public function platform()
    {
        return $this->hasOne(DataSpreadPlatform::class, 'id', 'spread_platform_id')->withTrashed()->select('id','name');
    }

    public function company()
    {
        return $this->hasOne(Company::class, 'id', 'company_id')->withTrashed()->select('id','name');
    }


}
